<template>
  <div>
    <h1>map</h1>
    <h2>{{ count }}</h2>
    <h2>{{ evenOrOdd }}</h2>
    <button @click="add">+</button>
    <button @click="decrement">-</button>
    <button @click="addIfEven">如果是偶数+1</button>
    <button @click="decrementIfOdd">如果是奇数延迟1000ms-1</button>
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
export default {
  computed: {
    ...mapState(["count"]),
    ...mapGetters(["evenOrOdd"])
  },
  methods: {
    ...mapMutations(["add", "decrement"]),
    ...mapActions(["addIfEven", "decrementIfOdd"])
  }
};
</script>

<style></style>
